  function forEach (arr,fn){
      for(let a = 0;a<arr.length;a++){
        fn(arr[a])
      }
  }
  
//   forEach(arr,function(item){
//     console.log(item)
//   })
function filter(arr,fn){
    let results = [];
    for(let i=0;i<arr.length;i++){
        if(fn(arr[i])){
            results.push(arr[i])
        }
    }
    return results
}
let array = [1,2,3,4,5]
let aaa = filter(array,function(item){
    return item % 2===0
})
console.log(aaa)